<?php
namespace Attendance\Controller;
use Common\Controller\AdminbaseController;
use Home\Service\AccountService;
// +----------------------------------------------------------------------
// | Date:2017年9月11日
// +----------------------------------------------------------------------
// | Author: EK_熊<1439527494@qq.com>
// +----------------------------------------------------------------------
// | Description: 此文件作用于****
// +----------------------------------------------------------------------
class OvertimeController extends AdminbaseController{
    
    public function index(){
        
        if (IS_POST) {
            $time = I('time');
            $name = I('name');
            if (!$name) $this->error('请输入姓名');
            $account = new AccountService();
            $userinfo = $account->get_user_by_field(['ep_name'=>['like',"%{$name}%"]]);
            
            $attenModel = D('AttendanceDay');
//             $day = date("Y-m-d",strtotime("$time +60 day"));
            $start_from_60 = date("Y-m-d",strtotime("$time -60 day"));//60天以前
            $overtime = $attenModel->count_remain_overtime($userinfo['sn'],$start_from_60,$time);
            $list['overtime_total'] = time_hour_min_zh($overtime);
            $list['date'] = $time;
            $this->assign('list',$list);
        }
        $this->display();
    }
    
    
}